package com.example.interviewassistant;

public class ApiConfig {
    private String apiUrl;
    private String apiKey;
    private String modelType;

    public ApiConfig(String apiUrl, String apiKey, String modelType) {
        this.apiUrl = apiUrl;
        this.apiKey = apiKey;
        this.modelType = modelType;
    }

    public String getApiUrl() {
        return apiUrl;
    }

    public void setApiUrl(String apiUrl) {
        this.apiUrl = apiUrl;
    }

    public String getApiKey() {
        return apiKey;
    }

    public void setApiKey(String apiKey) {
        this.apiKey = apiKey;
    }
    
    public String getModelType() {
        return modelType;
    }
    
    public void setModelType(String modelType) {
        this.modelType = modelType;
    }
    
    /**
     * 检查API配置是否有效
     * @return 配置是否有效
     */
    public boolean isValid() {
        return apiUrl != null && !apiUrl.trim().isEmpty() && 
               apiKey != null && !apiKey.trim().isEmpty() && 
               modelType != null && !modelType.trim().isEmpty();
    }
    
    /**
     * 获取API类型(OpenAI或DeepSeek)
     * @return API类型的枚举值
     */
    public ApiType getApiType() {
        if (modelType != null) {
            if (modelType.startsWith("gpt-")) {
                return ApiType.OPENAI;
            } else if (modelType.equals(ApiConfigManager.MODEL_DEEPSEEK)) {
                return ApiType.DEEPSEEK;
            }
        }
        return ApiType.UNKNOWN;
    }
    
    /**
     * 获取模型名称
     * @return 模型名称
     */
    public String getModelName() {
        return modelType;
    }
} 